package com.leil.project.data

import com.leil.project.domain.Reminder
import com.leil.project.domain.UUID

class RemindersRepository {
    private val _reminders: MutableList<Reminder> = mutableListOf()

    val reminders: List<Reminder>
        get() = _reminders

    fun createReminder(description: String, groupName: String, deadline: String) {
        val reminder = Reminder(
            id = UUID().toString(),
            description = description,
            groupName = groupName,
            deadline = deadline
        )
        _reminders.add(reminder)
    }

    fun markReminder(id: String, isComplete: Boolean) {
        val index = _reminders.indexOfFirst { it.id == id }
        if (index >= 0) {
            _reminders[index] = _reminders[index].copy(isComplete = isComplete)
        }
    }


}